﻿using System.Collections.Generic;
using Entitas;
class EnemyStopRoamingSystem :ReactiveSystem<EnemyEntity>
{
    public EnemyStopRoamingSystem(Contexts contexts) : base(contexts.enemy)
    {

    }

    protected override void Execute(List<EnemyEntity> entities)
    {
        foreach(var e in entities)
        {
            e.RemoveRoamingAngle();
            e.RemoveRoamingTimer();
        }
    }

    protected override bool Filter(EnemyEntity entity)
    {
        return entity.hasRoamingAngle&&entity.hasRoamingTimer;
    }

    protected override ICollector<EnemyEntity> GetTrigger(IContext<EnemyEntity> context)
    {
        return context.CreateCollector(EnemyMatcher.Roaming.Removed());
    }
}

